How To Build Util-linux for ARM


Intro


In this How To we are going to build util-linux 2.24 with our GCC/G++ 4.8.2 cross-compiler. Be sure to start this build in a new terminal/tab to avoid any pollution from previous builds. At the time, I only needed the col program (for man). Feel free to take it beyond that :-)

Tar Balls


Here is a list of source packages that we'll need for the build. You can either download them now or wait 'til later in the How To.
  • util-linux-2.24

Create a Workspace


I recommend creating a workspace under your /home/<your user>/ directory that is dedicated to this build. So let's fire up your terminal and run the following:
$ export UTIL_LINUX_SRC=~/workbench/utillinux/src
$ export UTIL_LINUX_BUILD=~/workbench/utillinux/build
$ mkdir -pv ~/workbench/utillinux
$ mkdir $UTIL_LINUX_SRC && mkdir $UTIL_LINUX_BUILD
$ cd $UTIL_LINUX_SRC

Gather the Sources


Now that we have a workspace created and we are currently in the src directory we can begin bringing down the sources and extracting them.

util-linux

$ wget https://www.kernel.org/pub/linux/utils/util-linux/v2.24/util-linux-2.24.tar.gz
$ tar -pxf util-linux-2.24.tar.gz

Build Environment


To make things a little smoother let's setup some environment variables:
$ export INSTALLDIR=~/workbench/gcc-g++-4.8.2/arm
$ export PATH=$INSTALLDIR/bin:$PATH
$ export TARGETMACH=arm-none-linux-gnueabi
$ export BUILDMACH=i686-pc-linux-gnu
$ export CROSS=arm-none-linux-gnueabi
$ export CC=${CROSS}-gcc
$ export LD=${CROSS}-ld
$ export AS=${CROSS}-as
$ export CXX=${CROSS}-g++
NOTE: Depending on whether you are using a cross-compiler built from my other wikis you might need to change INSTALLDIR to point to your cross-compiler.

Build Util-linux


Again, at the time I just needed the col program. So, that's all I'm building here. Make them all if you want 8P
$ cd ../build/
$ ../src/util-linux-2.24/./configure --prefix=/home/<your user>/workbench/utillinux/final --host=$TARGETMACH
$ make col
$ make install

Output


Yours will obviously vary depending on what you built. Want more info??